package com.turing.post.cardmanagement.impl;

import java.math.BigInteger;
import java.util.List;

import javax.ejb.Local;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import com.turing.post.cardmanagement.util.TransferInOutStockOrderDetail;
import com.turing.post.cardmanagement.util.TransferInOutStockOrderDetailDao;
import com.turing.post.util.GeneralDao;
import com.turing.post.util.PCPSApplicationException;

/**
 * 
 * @author YangShuo 卡调拨明细表接口实现类
 * 
 */
@Stateless(mappedName = "cardmanagement.impl.TransferInOutStockOrderDetailDaoImpl")
@Remote
@Local
public class TransferInOutStockOrderDetailDaoImpl implements
		TransferInOutStockOrderDetailDao {

	@PersistenceContext
	protected EntityManager _em;

	@SuppressWarnings("unchecked")
	@Override
	public List<TransferInOutStockOrderDetail> getTransferInOutStockOrderDetail(
			BigInteger TRANSFERINOUTSTOCKORDERID) {
		String sql = "select * from TransferInOutStockOrderDetail where TransferInOutStockOrderID="
				+ TRANSFERINOUTSTOCKORDERID;
		Query query = _em.createNativeQuery(sql,
				TransferInOutStockOrderDetail.class);
		return query.getResultList();
	}

	@Override
	public void insertTransferInOutStockOrderDetail(
			TransferInOutStockOrderDetail TransferInOutStockOrderDetail)
			throws PCPSApplicationException {
		// TODO Auto-generated method stub
		GeneralDao.insert(_em, TransferInOutStockOrderDetail);
	}

}
